package com.pansoft.kline.adapter;

import androidx.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.efounder.utils.JfResourceUtil;
import com.pansoft.kline.model.TableInfo;
import com.pansoft.openplanet.R;

import java.util.List;

/**
 * @author : zzj
 * @e-mail : zhangzhijun@pansoft.com
 * @date : 2018/11/12 11:36
 * @desc :
 * @version: 1.0
 */
public class DealRealFundAdapter extends BaseQuickAdapter<TableInfo,BaseViewHolder> {


    public DealRealFundAdapter(int layoutResId, @Nullable List<TableInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, TableInfo item) {
        helper.setText(R.id.tv_time,item.getTime());
        TextView tv_buy = helper.getView(R.id.tv_buy);
        TextView tv_sale = helper.getView(R.id.tv_sale);
        TextView tv_flow_into = helper.getView(R.id.tv_flow_into);
        tv_buy.setText(item.getBuy());
        tv_sale.setText(item.getSale());
        tv_flow_into.setText(item.getFlowInto());
        if(helper.getAdapterPosition() == 0){
            tv_buy.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            tv_sale.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            tv_flow_into.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
        }else {
            tv_buy.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            tv_sale.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            if(!item.getFlowInto().contains("-")){
                tv_flow_into.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            }else {
                tv_flow_into.setTextColor(JfResourceUtil.getSkinColor(R.color.black_text_color));
            }
        }

    }
}
